home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 33
/
Volume 33 - JOGO DISK .iso
/
Games
/
shoot_em_in.swf
/
scripts
/
DefineSprite_136
/
frame_37
/
DoAction.as
Wrap
Text File
|
2007-01-15
|
7KB
|
271 lines
lWindDiv = vyball - 17.9;
if(lWindDiv < 0)
{
lWindDiv = 0;
}
else if(2 < lWindDiv)
{
lWindDiv = 2;
}
lWindDiv = (2 - lWindDiv) / 2;
vXWind2 = vXWind * lWindDiv;
vZWind2 = vZWind * lWindDiv;
if(lbut != 1)
{
vXVector += vXWind2;
vZVector += vZWind2;
}
vXBall += vXVector - vXVectorEffect;
vYBall += vYVector;
vZBall += vZVector;
vXVectorEffect /= vDivEffect;
if(vYBall < _YFloor)
{
vYVector += vGravity;
}
if(_YFloor < vYball)
{
vYVector = - vYVector;
vYball = _Yfloor;
vXVector /= vDiv;
vYVector /= vDiv;
vZVector /= vDiv;
_parent.mcsounds.gotoAndPlay("hitfloor");
}
lLenght = vXVector * vXVector + vYVector * vYVector + vZVector * vZVector;
if(lLenght < 0.001 and _YFloor - 0.001 < vYBall)
{
gotoAndStop(44);
}
if(50 - (ldball + ldpot / 2) < vZBall and vZBall < 50 + (ldball + ldpot / 2))
{
collisions();
}
if(50 < vZBall and ltest != 1)
{
ltest = 1;
if(lcol1 != 3 and lcol2 != 3 and lcol3 != 3)
{
lxb = vxball;
lyb = vyball;
lzb = vzball;
vXBall -= (vXVector - vXVectorEffect) / 2;
vYBall -= vYVector / 2;
vZBall -= vZVector / 2;
collisions();
if(lcol1 != 3 and lcol2 != 3 and lcol3 != 3)
{
vXBall = lxb;
vYBall = lyb;
vZBall = lzb;
}
}
}
var i = 1;
while(vNBWall >= i)
{
name = eval("_parent.mcWall" + i);
if(vZBall < vzWall[i] + ldwall + ldball and vzWall[i] - (ldwall + ldball) < vZBall and vTestWall[i] != 1)
{
lxb = vXBall;
lzb = vZBall;
lDistTrans = Math.sqrt((vxWall[i] - lxb) * (vxWall[i] - lxb) + (vzWall[i] - lzb) * (vzWall[i] - lzb));
if(ldball / 2 + ldwall / 2 >= lDistTrans and _YFloor - lplayerHeight < vYball)
{
name.gotoAndStop("stop");
vxslope = lxb - vxWall[i];
vzslope = lzb - vzWall[i];
vXBall = vxWall[i] + vxslope / lDistTrans * (ldball / 2 + ldwall / 2);
vZBall = vzWall[i] + vzslope / lDistTrans * (ldball / 2 + ldwall / 2);
lLenght = Math.sqrt(vxslope * vxslope + vzslope * vzslope);
vxslope /= lLenght;
vzslope /= lLenght;
lambda = vXVector * vxslope + vZVector * vzslope;
vXVector = 2 * lambda * vxslope - vXVector;
vZVector = 2 * lambda * vzslope - vZVector;
vXVector /= vDiv;
vZVector /= vDiv;
vTestWall[i] = 1;
_parent.mcsounds.gotoAndPlay("hitwall");
}
}
i++;
}
if(30 < vZBall)
{
lz1 = vzgoal - vZBallStart;
lz2 = vzgoal - vZBall;
lx2 = lz2 * vXBallStart / lz1;
lxball2 = vXBall - lx2;
lyball2 = vYBall;
lzball2 = vzgoal;
}
if(40 + int((vmaxframes - vnbframes2) / 1.5) < vZBall and vTestgoal != 1)
{
if(lxball2 < vxgoal - 1.22)
{
if(lyball2 < _yfloor - 1.5)
{
_parent.mcgoal.gotoAndStop("jumpleft");
}
else
{
_parent.mcgoal.gotoAndStop("diveleft");
}
lGoalSide = 1;
}
else if(vxgoal + 1.22 < lxball2)
{
if(lyball2 < _yfloor - 1.5)
{
_parent.mcgoal.gotoAndStop("jumpright");
}
else
{
_parent.mcgoal.gotoAndStop("diveright");
}
lGoalSide = 2;
}
else
{
if(lyball2 < _yfloor - 1.5)
{
_parent.mcgoal.gotoAndStop("jump");
}
else
{
_parent.mcgoal.gotoAndStop("front");
}
lGoalSide = 3;
}
vTestGoal = 1;
}
if(vTestgoal2 == 50 and lGoalSide != 2 and lGoalSide != 1 or lGoalSide != 3 and lGoalSide != 2 and lGoalSide != 1 and 50 < vzball)
{
_parent.mcgoal.gotoAndStop("front");
}
if(35 < vZBall and 50 >= vZBall and vTestgoal2 < 60 or 50 < vZBall and vTestgoal2 < 20)
{
if(vTestgoal2 < 1)
{
_parent.mcgoal.gotoAndStop("walk");
}
if(vxgoal < lxball2 and lGoalSide != 1)
{
if(lxball2 - vxgoal < 0.1)
{
vxgoal += lxball2 - vxgoal;
}
else
{
vxgoal += 0.1;
}
}
else if(lxball2 < vxgoal and lGoalSide != 2)
{
if(vxgoal - lxball2 < 0.1)
{
vxgoal -= vxgoal - lxball2;
}
else
{
vxgoal -= 0.1;
}
}
v2DPoint = WorldToScreen(vxgoal,vygoal,vzgoal,_Focale,_scale,_xoffset,_yoffset);
_parent.mcgoal._x = v2DPoint.x;
_parent.mcgoal._y = v2DPoint.y;
vTestgoal2++;
}
if(vzgoal - ldball * 2 < vZBall and vZBall < vzgoal + ldball * 2 and vTestgoal3 == 0)
{
v2DPoint = WorldToScreen(lxball2,lyball2,lzball2,_Focale,_scale,_xoffset,_yoffset);
lHitTest = _parent.mcgoal.mccollision.hitTest(v2DPoint.x,v2DPoint.y,true);
if(lHitTest)
{
vZVector = - vZVector;
vectorDivGoal();
vTestgoal3 = 1;
_parent.mcsounds.gotoAndPlay("hitgoal");
}
}
if(50 + ldball / 2 < vZBall and ltestBut < 2)
{
if(lbut != 1)
{
if(-3.66 + (ldball / 2 + ldpot / 2) < vXBall and vXBall < 3.66 - (ldball / 2 + ldpot / 2))
{
if(_YFloor - 2.44 + (ldball / 2 + ldpot / 2) < vYBall)
{
lbut = 1;
_parent.mcbut.gotoAndStop("but");
_parent.mcsounds.gotoAndPlay("but");
}
}
}
if(lbut != 1)
{
if(-3.66 < vXBall - (vXVector - vXVectorEffect) / 2 and vXBall - (vXVector - vXVectorEffect) / 2 < 3.66)
{
if(_YFloor - 2.44 < vYBall - vYVector / 2)
{
vXBall -= (vXVector - vXVectorEffect) / 2;
vYBall -= vYVector / 2;
vZBall -= vZVector / 2;
lbut = 1;
_parent.mcbut.gotoAndStop("but");
_parent.mcsounds.gotoAndPlay("but");
}
}
}
ltestBut++;
}
if(lbut == 1 and 50 < vZBall)
{
if(vXBall < -3.66 and vXVector < 0)
{
vXBall = -3.66;
vXVector = - vXVector;
VectorDiv();
}
if(3.66 < vXBall and 0 < vXVector)
{
vXBall = 3.66;
vXVector = - vXVector;
vectorDiv();
}
if(vYBall < _YFloor - 2.44 and vYVector < 0)
{
vYBall = _YFloor - 2.44;
vYVector = - vYVector;
vectorDiv();
}
if(52 < vZBall and 0 < vZVector)
{
vZBall = 52;
vZVector = - vZVector;
vectorDiv();
}
}
if(lbut != 1 and 50 < vZBall)
{
if(60 < vZBall and 0 < vZVector)
{
vZBall = 60;
vZVector = - vZVector;
vectorDivGoal();
_parent.mcsounds.gotoAndPlay("hitwall");
}
}
v2DPoint = WorldToScreen(vXBall,vYBall,vZBall,_Focale,_scale,_xoffset,_yoffset);
_parent.mcball._x = v2DPoint.x;
_parent.mcball._y = v2DPoint.y;
_parent.mcball._xscale = v2DPoint.z * 2 * ldball;
_parent.mcball._yscale = v2DPoint.z * 2 * ldball;
v2DPoint = WorldToScreen(vXBall,_Yfloor + 0.05,vZBall,_Focale,_scale,_xoffset,_yoffset);
_parent.mcShadow._x = v2DPoint.x;
_parent.mcShadow._y = v2DPoint.y;
_parent.mcShadow._xscale = v2DPoint.z * 4 * ldball;
_parent.mcShadow._yscale = v2DPoint.z * 2 * ldball;
prevFrame();